/**
 * 
 */
package hu.gbalage.owlforms.impl;

import hu.gbalage.owlforms.api.FieldCardinality;
import hu.gbalage.owlforms.api.data.FieldData;

/**
 * @author Grill Balazs (balage.g@gmail.com)
 *
 */
public class MaxFieldCardinality implements FieldCardinality {

	private final int c;
	
	public MaxFieldCardinality(int cardinality){
		this.c = cardinality;
	}
	
	/* (non-Javadoc)
	 * @see hu.gbalage.owlforms.api.FieldCardinality#canAddMore(hu.gbalage.owlforms.api.data.FieldData)
	 */
	public boolean canAddMore(FieldData fielddata) {
		return fielddata.listValues().size() < c;
	}

	/* (non-Javadoc)
	 * @see hu.gbalage.owlforms.api.FieldCardinality#isSufficient(hu.gbalage.owlforms.api.data.FieldData)
	 */
	public boolean isSufficient(FieldData fielddata) {
		return true;
	}

	public int getMax() {
		return c;
	}
	
	public int getMin() {
		return 0;
	}
	
}
